package com.bx.implatform.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bx.implatform.entity.Robot;
import com.bx.implatform.enums.MemberType;
import com.bx.implatform.mapper.RobotMapper;
import com.bx.implatform.service.RobotService;
import com.bx.implatform.vo.UserVO;
import org.springframework.stereotype.Service;

@Service
public class RobotServiceImpl extends ServiceImpl<RobotMapper, Robot> implements RobotService {

    @Override
    public UserVO findById(Long robotId) {
        Robot robot = this.getById(robotId);
        if(robot == null) {
            return null;
        }
        UserVO vo = new UserVO();
        vo.setId(robot.getId());
        vo.setNickName(robot.getName());
        vo.setSex(1);  // 机器人性别默认为1
        vo.setSignature(robot.getIntroduction());
        vo.setHeadImage(robot.getHeadImage());
        vo.setHeadImageThumb(robot.getHeadImageThumb());
        vo.setMemberType(MemberType.ROBOT.code());
        return vo;
    }
}
